//
//  AMPRegisterAuthCodeViewController.swift
//  LivingHelper
//
//  Created by Ampaw on 2017/9/14.
//  Copyright © 2017年 Ampaw. All rights reserved.
//

import UIKit

class AMPRegisterAuthCodeViewController: AMPBaseViewController {

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "获取验证码"
        // 准备UI
        setUpUI()
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing(true)
    }
    
    // MARK: - 准备UI
    private func setUpUI() {
        self.authcodeView.authCodeViewDelegate = self
        self.view.addSubview(self.authcodeView)
        
        unowned let WS = self
        self.authcodeView.snp.makeConstraints { (make) -> Void in
            make.edges.equalTo(WS.view)
        }
    }
    
    // MARK: - 懒加载
    lazy var authcodeView: AMPAuthCodeView = {
        let authView = AMPAuthCodeView(type: 1)
        
        return authView
    }()

}

// MARK: - 扩展
/// 扩展 AMPRegisterAuthCodeViewController 实现 AMPAuthCodeViewDelegate 协议
extension AMPRegisterAuthCodeViewController: AMPAuthCodeViewDelegate {
    func didGetAuthCode() {
        self.view.endEditing(true)
        print("获取验证码")
    }
    
    func didNextJump() {
        self.view.endEditing(true)
        print("下一步")
        let pwdVC = AMPRegisterSetPwdViewController()
        self.navigationController?.pushViewController(pwdVC, animated: true)
    }
}
